package  
{
	import cn.inswf.framework.mvcs.Context;
	import command.StartUpCommand;
	import event.PlayerEvent;
	import flash.display.DisplayObjectContainer;
	import service.DataLoader;
	/**
	 * ...
	 * @author lee
	 */
	public class AppContext extends Context 
	{
		private var _container:DisplayObjectContainer;
		private static var _init:Boolean;
		public function AppContext(container:DisplayObjectContainer) 
		{
			super(container);
			Helper;
			setInstance(AppContext, this);
			_container = container;
			Config.stage = _container.stage;
			start();
		}
		public function start():void {
			if (_init) return;
			_init = true;
			Config.height = _container.stage.stageHeight;
			Config.width = _container.stage.stageWidth;
			mapCommand(PlayerEvent.START, StartUpCommand, PlayerEvent, true);
			dispatchEvent(new PlayerEvent(PlayerEvent.START));
			getInstance(DataLoader);
		}
	}

}